import time
from datetime import datetime

# 类方法
# TODO datetime.now() 获取当前时间的日期时间对象
# now = datetime.now()
# print(type(now),now)

# TODO datetime.today（） 当前时间，localtime
# print(datetime.today())

# TODO datetime.utcnow()  当前UTC时间
# print(datetime.utcnow())

# TODO # datetime.fromtimestamp()	将时间戳的转换为datetime对象。
# times = time.time()
# print(datetime.fromtimestamp(times))
# print(type(datetime.fromtimestamp(times)))

# TODO datetime.strptime(str,fmt)	按照fmt的格式将字符串时间， 转化为datetime时间
# datetime_str = '2022-06-1 11:35:35'
# datetime_obj = datetime.strptime(datetime_str, '%Y-%m-%d %H:%M:%S')
# print(type(datetime_obj))

# 对象方法
# TODO datetime_obj.date()  返回date对象
# dt1 = datetime.today()
# print(type(dt1.date()))
# print(dt1.date())

# TODO datetime_obj.time() 返回time对象
dt1 = datetime.today()
print(dt1.time(), type(dt1.time()))   # datetime.time 的对象

# TODO datetime_obj.strftime(fmt)   # 按照格式将datetime对象转化为字符串时间
# dt1 = datetime.today()  # datetime 对象
# print(dt1.strftime("%Y-%m-%d %H:%M:%S"))
# print(type(dt1.strftime("%Y-%m-%d %H:%M:%S")))
















